﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

/// <summary>
/// Summary description for Conexion
/// </summary>
public class Conexion
{



    /*private static String connectionString = "user id=CESAR-LAPTOP/CESAR;" +
                                             "password=;" +
                                             "server=CESAR-LAPTOP;" +
                                             "Trusted_Connection=yes;" +
                                             "database=pingeso12010bodegas;";*/


    private string connectionString = ConfigurationManager.ConnectionStrings["stringconnection"].ConnectionString;
 
        private static SqlConnection conn1 = null;

        
        public Conexion ()
        {
        
        }

        public SqlConnection getConn()
        {
            return conn1;
        }

        public bool iniciarConexion()
        {

            try
            {
                conn1 = new SqlConnection(connectionString);
                conn1.Open();
                return true;
            }
            catch(Exception exc)
            {
                
                return false;
            }
           
        }

        public bool terminarConexion()
        {
            try
            {
                conn1.Close();
                return true;
            }

            catch (Exception exc)
            {
                return false;
            }
        }

       
}